Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move some Device methods to private section #16259

Merged
merged 4 commits into from
Dec 25, 2024

Conversation

ayerofieiev-tt
Copy link
Member

@ayerofieiev-tt ayerofieiev-tt commented Dec 23, 2024

Ticket

None

Problem description

There are plenty of Device methods which are only used by device itself but they are in a public section

This PR depends on #16256

What's changed

This PR does not add any new functionality, nor changes existing. It shuffles things around.

  • Moved near every method thats only used by Device to the private section (19)
  • Re-groupped methods logically: methods that proxy to allocator, to cluster
  • Moved a couple implementations to cpp
  • Reviewed usage of some methods, left comments where its desirable to review usage with owners
  • Removed template where it was not used

Whats next:

  • Discuss and align what we can/want to do about the two outlined groups of methods
  • Review notes with owners, align on next steps

Checklist

Copy link
Collaborator

@cfjchu cfjchu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔥 Great, thank you! Couple requests:

  1. Remove the debug comments before merge.
  2. It would also be helpful to have a list of the methods removed and methods switched from public->private in the PR description since it's hard to see in the diff.

tests/tt_metal/tt_metal/eth/test_ring_gather_kernels.cpp Outdated Show resolved Hide resolved
Comment on lines -135 to -137
std::unordered_set<chip_id_t> get_ethernet_connected_device_ids() const {
return tt::Cluster::instance().get_ethernet_connected_device_ids(this->id_);
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are a number of these kind of methods that just reach into tt::Cluster::instance() to do the lookup. We should be able to strip these methods from Device.

Copy link
Member Author

@ayerofieiev-tt ayerofieiev-tt Dec 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes.
There are also 32 allocator related methods in device.

But before acting on this, must align with stakeholders.

tt_metal/impl/device/device.hpp Outdated Show resolved Hide resolved
tt_metal/impl/device/device.hpp Outdated Show resolved Hide resolved
tt_metal/impl/device/device.hpp Outdated Show resolved Hide resolved
Copy link
Contributor

@tt-aho tt-aho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me as long as the review comments are removed prior to merge. Review/discussions of the api choice/design can happen later if we're just interested in getting this part of the cleanup merged first.

tt_metal/impl/device/device.cpp Outdated Show resolved Hide resolved
tt_metal/impl/device/device.cpp Show resolved Hide resolved
tt_metal/impl/device/device.hpp Outdated Show resolved Hide resolved
tt_metal/impl/device/device.hpp Outdated Show resolved Hide resolved
tt_metal/impl/device/device.cpp Outdated Show resolved Hide resolved
Copy link
Contributor

@dmakoviichuk-tt dmakoviichuk-tt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can add a couple nodiscards to some apis. in this pr.

@ayerofieiev-tt
Copy link
Member Author

I think you can add a couple nodiscards to some apis. in this pr.

Not doing this in this PR, keeping the scope down.

@ayerofieiev-tt ayerofieiev-tt merged commit a927a47 into main Dec 25, 2024
184 checks passed
@ayerofieiev-tt ayerofieiev-tt deleted the ay/move_device_methods_to_private branch December 25, 2024 06:44
arikTT pushed a commit that referenced this pull request Dec 27, 2024
### Ticket
None

### Problem description
There are plenty of Device methods which are only used by device itself
but they are in a public section

This PR depends on #16256

### What's changed
This PR does not add any new functionality, nor changes existing. It
shuffles things around.
* Moved near every method thats only used by Device to the private
section (19)
* Re-groupped methods logically: methods that proxy to allocator, to
cluster
* Moved a couple implementations to cpp
* Reviewed usage of some methods, left comments where its desirable to
review usage with owners
* Removed template where it was not used

Whats next:
* Discuss and align what we can/want to do about the two outlined groups
of methods
* Review notes with owners, align on next steps

### Checklist
- [ ] [Post commit
CI](https://github.com/tenstorrent/tt-metal/actions/runs/12475902305)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants